#include "CompoundDevice.h"


bool CompoundDevice::recheck() noexcept {
    bool result = false;
    for (TypeToDeviceMap::iterator iterator = msubDevices.begin(); iterator != msubDevices.end(); ++iterator) {
        result |= iterator->second->recheck();
    }

    return result;
}


bool CompoundDevice::activeUpdateInformation() {
    bool result = false;
    for (TypeToDeviceMap::iterator iterator = msubDevices.begin(); iterator != msubDevices.end(); ++iterator) {
        result |= iterator->second->activeUpdateInformation();
    }

    return true;
}


bool CompoundDevice::updateInformation() {
    bool result = false;
    for (TypeToDeviceMap::iterator iterator = msubDevices.begin(); iterator != msubDevices.end(); ++iterator) {
        result |= iterator->second->updateInformation();
    }

    return true;
}



ExtendDevice* CompoundDevice::getDevice(const ExtendDeviceType& deviceType) {
    ExtendDevice* prealDevice = nullptr;
    TypeToDeviceMap::iterator pos = msubDevices.find(&deviceType);
    if ( msubDevices.end() != pos){
        prealDevice = pos->second;
    }

    return prealDevice;
}




